﻿Public Class Form1
    Dim base_d_datos As String = "SG_COMANDERSQL"
    Public enlace As ADODB.Connection
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Console.WriteLine(System.IO.Directory.GetCurrentDirectory.ToString)
        Console.WriteLine(CurDir())

        Dim url_Servidor As String = "Provider=SQLOLEDB;Data Source=JONATHAN-PC\SQLEXPRESS;Initial Catalog=" & base_d_datos & ";Integrated Security=SSPI"
        Console.WriteLine(url_Servidor)

        enlace = New ADODB.Connection
        'enlace.Open("Provider=SQLOLEDB; " & _
        '"Initial Catalog=SG_COMANDERSQL; " & _
        ' "Data Source=JONATHAN-PC\SQLEXPRESS; " & _
        '"integrated security=SSPI;")
        enlace.Open(url_Servidor)


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        enlace = New ADODB.Connection
        enlace.ConnectionString = "driver={SQL Server};" & _
  "server=JONATHAN-PC\SQLEXPRESS;database=SG_COMANDERSQL;Integrated Security=True"
        enlace.ConnectionTimeout = 30
        enlace.Open()
    End Sub
End Class
